import InhouseOtaHelper from './inhouseHelper'
import type { OTAHelper, OTAHelperConfigOptions } from './types'
import BiwdOtaHelper from './biwdHelper'
import RefrigeratorBOtaHelper from './refrigeratorBHelper'

/**
 * Inhouse 家电类型
 */
const InhouseTypes = ['CoffeeMaker', 'Dishwasher', 'Dryer', 'Washer', 'WasherDryer', 'WineCooler', 'FridgeFreezer']

export function createOtaHelper(options: OTAHelperConfigOptions): OTAHelper | null {
  const { type } = options

  if (InhouseTypes.includes(type)) {
    return new InhouseOtaHelper(options)
  }

  if (type === 'BIWD') {
    return new BiwdOtaHelper(options)
  }

  if (type === 'RefrigeratorB') {
    return new RefrigeratorBOtaHelper(options)
  }

  return null
}
